<script setup>

import { ref, onMounted } from 'vue'
import { StarFilled } from "@element-plus/icons-vue";
import { useRoute } from 'vue-router'

const route = useRoute()

const userItems = [
  {index: '/user/rename', icon: 'Postcard', title: '实名认证'},
  {index: '/user/orders', icon: 'List', title: '挂号订单'},
  {index: '/user/patients', icon: 'Avatar', title: '就诊人员'},
  {index: '/user/account', icon: 'InfoFilled', title: '账号信息'},
  {index: '/user/feedback', icon: 'Comment', title: '意见反馈'},
]

onMounted(() => {
})

</script>

<template>
  <div class="user">
    <!-- 左侧菜单 -->
    <div class="user-left">
      <div class="logo">
        <el-icon><StarFilled /></el-icon>/会员中心
      </div>
      <el-menu
          :default-active="route.path"
          class="el-menu-vertical-demo"
          router
      >
        <el-menu-item v-for="(item, index) in userItems" :key="index" :index="item.index">
          <el-icon>
            <component :is="item.icon"/>
          </el-icon>
          <span>{{ item.title }}</span>
        </el-menu-item>
      </el-menu>
    </div>
    <!-- 右侧内容 -->
    <div class="user-right">
      <router-view></router-view>
    </div>
  </div>
</template>

<style scoped lang="scss">
.user {
  display: flex;
  width: 100%;
  height: 100%;

  .user-left {
    flex: 2;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;

    .logo {
      color: #7f7f7f;
      font-size: 18px;
      font-weight: bold;
      margin-bottom: 10px;
    }

    .el-menu-item span {
      margin-left: 5px;
      font-size: 16px;
      font-weight: bold;
    }
  }

  .user-right {
    flex: 8;
    background-color: #fff;
    padding: 10px;
    display: flex;
  }
}

</style>